﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Data.Mappers;

namespace TestsMyShop.Mappers_Test
{
    [TestFixture]
    public class Products
    {
        [Test]
        public void Should_convert_product_from_entity_to_model()
        {
            Entity.Products.Product product = new Entity.Products.Product();

            IMapper<Entity.Products.Product, Data.ModelDatabase.Product> mapper = new ProductMapper();
            Data.ModelDatabase.Product modelProduct = mapper.WrapperEntity(product);

            Assert.AreEqual(product.Description, modelProduct.Description);
            Assert.AreEqual(product.Name, modelProduct.Name);
            Assert.AreEqual(product.Id, modelProduct.Id);
        }

        [Test]
        public void Should_convert_product_from_model_to_entity()
        {
            Data.ModelDatabase.Product modelProduct = new Data.ModelDatabase.Product() { Name = "1", Description = "2", Id = 3 };

            IMapper<Entity.Products.Product, Data.ModelDatabase.Product> mapper = new ProductMapper();
            Entity.Products.Product product = mapper.WrapperData(modelProduct);

            Assert.AreEqual(product.Description, modelProduct.Description);
            Assert.AreEqual(product.Name, modelProduct.Name);
            Assert.AreEqual(product.Id, modelProduct.Id);
        }
    }
}
